<%--
  Created by IntelliJ IDEA.
  User: dj
  Date: 2018-08-30
  Time: 15:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<%@ include file="/common/baseMeta.jsp" %>
    <title>ICURZ</title>
	<script type="text/javascript">
        var uid = "${sysStaffEntity.uid}";//唯一标识
        var lname = "${sysStaffEntity.lname}"; //登录工号
    $(function(){
		$("#l_datagrid").height(findDimensions_height() - 50);
        //初始化表头
        initGrid();
		//初始化日期控件
		var myDate = new Date();
		$('#nd').val(myDate.getFullYear());
		var month=myDate.getMonth()+1;
		$('#yf').val(month.toString().length==1?'0'+month:month);
        $.getJSON("/commapiV2", {p_dm: "sys_ks_GetzyICU", userid: lname}, function (data) {
            if (data.success) {
				$('#ks').combobox({
                    data:data.Table,
                    valueField:'name',
                    textField:'name'
                });
				$('#ks').combobox('select',data.Table[0].name);
            }
            //getJSON方法与其他方法之间是同步加载方式，LoadGrid()方法放在外面取不到ks的值
            LoadGrid();
        }, true);
	})

	function LoadGrid()
	{
		//初始化数据
        $.getJSON("/commapiV2", {p_dm: "ICU_RZ_Get", rq: $('#nd').val()+'-'+$('#yf').val(),ks:$('#ks').combobox('getValue')}, function (data) {
            if (data.success) {
                var griddata = {};
                griddata.rows = data.Table;
                griddata.total = data.totalcount;
                $('#l_datagrid').datagrid('loadData', griddata);
            }
        }, true);
	}
	function initGrid() {
        $('#l_datagrid').datagrid({
            rownumbers: true,//显示行号
            singleSelect: true,//只显示一行
            fitColumns: true,
            sortable: true, //启用排序列
            collapsible: true,
            idField: 'id',
            columns: [
                [
                    {field: 'Sj', title: '日期', width: '90px', align: 'center'},
                    {field: 'NewCount', title: '新住进患者数', width: '120px', align: 'center'},
                    {field: 'TotalCount', title: '住在患者数', width: '120px', align: 'center'},
                    {field: 'dngCount', title: '留置导尿管患者数', width: '120px', align: 'center'},
                    {field: 'ZxJmCount', title: '中心静脉插管患者数', width: '120px', align: 'center'},
                    {field: 'HxjCount', title: '使用呼吸机患者数', width: '120px', align: 'center'},
                    {field: 'usermc', title: '用户名', width: '120px', align: 'center'},
                    {field: 'cdate', title: '填写日期', width: '120px', align: 'center'},
                    {field: 'KsCode', title: 'KsCode', hidden: true},
					
                ]
            ]
        });
    }
	function editItem()
	{   
        var row = $('#l_datagrid').datagrid('getSelected');
		var url = "/FormApi?mobanId=b365b0fc-02d1-4d4b-80e7-34885b10c0a5&dataId=" + row.id +"&mDefaultValue_SJ="+row.Sj+"&mDefaultValue_KSCODE="+row.KsCode;
        layeropen(800, 500, "ICU日志填写", url);
		var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
	}
        function loadList() {
            LoadGrid();
        }
	</script>
</head>
<body>
<div style="margin:0 5px; overflow: hidden;">
    <div class="navheader form-inline" style="height:40px;margin-bottom: 0px;">
        <div class=" form-group">
		    <label for="ZYNumber" style="padding:5px 10px 0 20px;">科室</label>
           <select id="ks" class="easyui-combobox"   style="height: 25px; width: 160px;">
                </select>
		    <label for="CYRQStart" style="padding:5px 10px 0 20px;">年度</label>
           <select id="nd"> 
		    <option value='2017'>2017</option>
		    <option value='2018'>2018</option>
		    <option value='2019'>2019</option>
		    <option value='2020'>2020</option>
		    <option value='2021'>2021</option>
		    <option value='2022'>2022</option>
			<option value='2023'>2023</option>
		   </select>
		    <label for="CYRQStart" style="padding:5px 10px 0 20px;">月份</label>
           <select id="yf"> 
		    <option value='01'>01</option>
		    <option value='02'>02</option> 
		    <option value='03'>03</option> 
		    <option value='04'>04</option> 
		    <option value='05'>05</option> 
		    <option value='06'>06</option> 
		    <option value='07'>07</option> 
		    <option value='08'>08</option> 
		    <option value='09'>09</option>  
		    <option value='10'>10</option>  
		    <option value='11'>11</option>  
		    <option value='12'>12</option> 
		    </select> 
		    <button type="button" class="btn btn-success bi-btn-search" onclick="LoadGrid()">
               <span class="glyphicon glyphicon glyphicon-search"></span>
           </button>
		    <div class="btn-group-right">
                   <div class="btn-group" role="group">
                       <button type="button" class="btn btn-default bi-btn-width90" onclick="editItem()">编辑</button>
                   </div>
               </div>
		</div>
    </div>
    <div style="width:100%;float:left;display:inline-block;padding-top:10px;">
        <table id="l_datagrid" class="datagrid" style="width:100%"></table>
    </div>
</div>
</body>
</html>
